<template>
  <div class="person_wrap">
    <h2>姓名:{{ name }}</h2>
    <h2>年龄:{{ age }}</h2>
    <button @click="changeName">修改名字</button>
    <button @click="changeAge">修改年龄</button>
    <button @click="btn">查看联系方式</button>
  </div>
</template>

<script lang="ts" setup name="Person2">
// 数据
let name = '张三';
let age = 18;
let tel = '3242342423432';
// 方法
function changeName() {
  name = 'zhangsan'
}
function changeAge() {
  age += 1
}
function btn() {
  alert(tel)
}
</script>

<style scoped>
.person_wrap {
  background-color: skyblue;
  width: 300px;
  height: 100px;
}
</style>